package cn.yjh.client;

import java.lang.reflect.Proxy;



/**
 * @DESC:
 * @AUTHOR: YouJinhua
 * @DATE: 2021-11-23 18:51:04
 * @VERSION: 1.0
 */
public class RPCProxyFactory {

    public static <T> T getRPCProxy(Class<T> clazz, String host, int port) {
        RPCHandler rpcHandler = new SocketChannelRPCHandler(host,port,clazz);
        Object result = Proxy.newProxyInstance(clazz.getClassLoader(), new Class[]{clazz}, rpcHandler);
        return   (T) result;
    }
}
